package net.oschina.app.ui.activity;

import android.webkit.WebView;
import android.webkit.WebViewClient;

import net.oschina.app.R;
import net.oschina.app.base.BaseActivity;

/**
 * Created by dfl on 2017/1/17.
 */

public class DetailActivity extends BaseActivity{

    @Override
    public int getLayoutRes() {
        return R.layout.activity_item_fragment;
    }

    @Override
    public void initView() {
        WebView webView = (WebView) findViewById(R.id.webView);
        String url = getIntent().getStringExtra("url");
        //WebView加载web资源
        webView.loadUrl(url);//覆盖WebView默认使用第三方或系统默认浏览器打开网页的行为，使网页用WebView打开
        webView.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
                view.loadUrl(url);
                return true;
            }
        });
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }
}
